package com.repair.worker.util;

import cn.hutool.core.util.RandomUtil;

/**
 * Created by IntelliJ IDEA.
 *
 * @author zq
 * @version 1.0
 * @create 2024-09-28 18:43
 * @since jdk1.8
 */
public class NicknameGenerator {
    /**
     * 生成昵称
     *
     * @param nickPrefix 昵称前缀
     * @return 构造后的昵称
     */
    public static String generateNickname(StringBuilder nickPrefix) {
        String nickMiddle = RandomUtil.randomNumbers(4);
        String nickTail = String.valueOf(System.currentTimeMillis()).substring(4, 8);
        // 使用StringBuilder来构建昵称
        StringBuilder nickname = new StringBuilder(nickPrefix)
                .append(nickMiddle)
                .append(nickTail);

        return nickname.toString();
    }
}

